<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>array</title>
</head>
<body>
<style>
    .like {
        width: 200px;
        height: 25px;
        display: block;
        background-color: #1EAA39;
        color: #fff;
        text-align: center;
    }
</style>
<h5>遍历内容生成二维数组</h5>
<div class="container">
    <div class="like" js="1" dt="a">this is a div!</div>
    <div class="like" js="2" dt="b">this is a div!</div>
    <div class="like" js="3" dt="c">this is a div!</div>
</div>

<script src="../jquery-1.7.2.js"></script>
<script>
    var goods_data = new Array();
    $(".container .like").each(function(i){
        $this = $(this);
        goods_data[i]=new Array();
        var thisCity = $this.attr('js');
        var thisId = $this.attr('dt');
        goods_data[i][0] = thisId;
        goods_data[i][1] = thisCity;

    });
    console.log(goods_data);
</script>
</body>
</html>
